package com.sys.goods.pojo;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.sys.common.pojo.BasePojo;

/**
 * 地区明细表
 * 
 * @author lby
 *
 */
public class AAddress extends BasePojo<AAddress> {
	private int addressId;
	private int userId;
	private String addressInformation;
	private String consigneeName;
	private String consigneeNumber;
	private byte isTheDefaultAddress;
	private String postal;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;

	private String statusStr;
	private String isTheDefaultAddressStr ; 

	/*
	 * 方便枚举项在网页上显示出来 键为值(数字), 值为字符串描述 只提供get方法
	 */
	private Map<String, String> enumsMap = new TreeMap<String, String>();

	public Map<String, String> getEnumsMap() {
		// 根据状态值获取字符串描述
		AAddressEnum[] aaddressenum = AAddressEnum.values();
		for (int i = 0; i < aaddressenum.length; i++) {
			AAddressEnum aaddressEnum = aaddressenum[i];
			String key = aaddressEnum.toString();
			enumsMap.put(key + "-" + aaddressEnum.getStatus() + "", aaddressEnum.getName());
		}
		return enumsMap;
	}

	public String getStatusStr() {
		AAddressEnum[] values = AAddressEnum.values();
		for (int i = 0; i < values.length; i++) {
			AAddressEnum aaddressEnumTemp = values[i];
			if (aaddressEnumTemp.toString().startsWith("STATUS")) {
				if (aaddressEnumTemp.getStatus() == this.status) {
					this.statusStr = aaddressEnumTemp.getName();
				}
			}
		}
		return statusStr;
	}
	
	public String getIsTheDefaultAddressStr() {
		AAddressEnum[] values = AAddressEnum.values();
		for (int i = 0; i < values.length; i++) {
			AAddressEnum aaddressEnumTemp = values[i];
			if (aaddressEnumTemp.toString().startsWith("DEFAULT_")) {
				if (aaddressEnumTemp.getStatus() == this.isTheDefaultAddress) {
					this.isTheDefaultAddressStr = aaddressEnumTemp.getName();
				}
			}
		}
		return isTheDefaultAddressStr;
	}

	public byte getIsTheDefaultAddress() {

		return isTheDefaultAddress;
	}

	public void setIsTheDefaultAddress(byte isTheDefaultAddress) {
		this.isTheDefaultAddress = isTheDefaultAddress;
	}

	public int getAddressId() {
		return addressId;
	}

	public void setAddressId(int addressId) {
		this.addressId = addressId;
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getAddressInformation() {
		return addressInformation;
	}

	public void setAddressInformation(String addressInformation) {
		this.addressInformation = addressInformation;
	}

	public String getConsigneeName() {
		return consigneeName;
	}

	public void setConsigneeName(String consigneeName) {
		this.consigneeName = consigneeName;
	}

	public String getConsigneeNumber() {
		return consigneeNumber;
	}

	public void setConsigneeNumber(String consigneeNumber) {
		this.consigneeNumber = consigneeNumber;
	}

	public String getPostal() {
		return postal;
	}

	public void setPostal(String postal) {
		this.postal = postal;
	}

	public byte getStatus() {
		return status;
	}

	public void setStatus(byte status) {
		this.status = status;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Date getPubTime() {
		return pubTime;
	}

	public void setPubTime(Date pubTime) {
		this.pubTime = pubTime;
	}

}
